class Control {

  static navControl(minX, minY, maxX, maxY) {
    return new ol.control.ZoomToExtent({
      extent: [minX, minY, maxX, maxY]
    })
  }
  static zoomSlider() {
    return new ol.control.ZoomSlider()
  }
  static rotateControl() {
    return new ol.control.Rotate()
  }
  static fullScreenControl() {
    return new ol.control.FullScreen()
  }
  static scaleControl() {
    return new ol.control.ScaleLine({
      /* 设置比例尺单位,degrees,imperial,us,nautical,metric */
      units: 'metric'
    })
  }
  static mousePositionControl() {
    return new ol.control.MousePosition({
      /* 坐标格式 */
      coordinateFormat: ol.coordinate.createStringXY(4),
      projection: 'EPSG:4326',
      /* 坐标信息显示样式类名,默认是'ol-mouse-position' */
      className: 'custom-mouse-position',
      target: document.getElementById('mouse-position'),
      undefinedHTML: '&nbsp'
    })
  }
  static overviewMapControl(layers) {
    return new ol.control.OverviewMap({
      /* 鹰眼控件样式  */
      className: 'ol-overviewmap ol-custom-overviewmap',
      layers,
      /* 鹰眼控件展开时功能按钮上的标识(网页的JS的字符编码) */
      collapseLabel: '\u00BB',
      /* 鹰眼控件折叠时功能按钮上的标识(网页的JS的字符编码) */
      label: '\u00AB',
      /* 初始为展开显示方式 */
      collapsed: false,
      view: new ol.View({
        projection: 'EPSG:4326',
        minZoom: 8,
        maxZoom: 18
      })
    })
  }
}

export default Control